package com.huluobo.a2204kotlinshopping.search

import androidx.lifecycle.MutableLiveData
import com.huluobo.base.bean.HomeGoodsBean
import com.huluobo.base.bean.HomeGoodsBeanResult
import com.huluobo.base.bean.KeyWordBean
import com.huluobo.base.viewmodel.BaseViewModel

/**
 *  Created by LC on 2024/7/26.
 */
class SearchViewModel : BaseViewModel<SearchRepo>() {

    val goodsListSuccess = MutableLiveData<HomeGoodsBeanResult>()
    val goodsListFailed = MutableLiveData<String>()

    val queryKeywordSuccess = MutableLiveData<List<KeyWordBean>>()
    val queryKeywordFailed = MutableLiveData<String>()

    fun deleteKeyword(keyWordBean: KeyWordBean) {
        repo.deleteKeyword(keyWordBean)
    }

    fun queryKeyword() {
        repo.queryKeyword(queryKeywordSuccess, queryKeywordFailed)
    }

    fun getGoodsList(categoryId: Int, currentPage: Int, pageSize: Int) {
        repo.getGoodsList(categoryId, currentPage, pageSize, goodsListSuccess, goodsListFailed)
    }

    override fun createRepo(): SearchRepo = SearchRepo()
}